<?php $articleObj=(new Zmsun\Copen\TopPackage("zm345.open.enterpr",new Zmsun\Copen\OpenLib($this->serviceManager->get("Database"),$this->serviceManager->get("DBTablePrefix"))))->article;$ZGHEAD=<<<S
<link rel="stylesheet" type="text/css" href="{$this->assetsUri()}/css/default.css" media="all">
<script type="text/javascript" src="{$this->assetsUri()}/js/default.js"></script>
S;
$cateGet=$articleObj->articleCatsGet;$categories=$cateGet->setFields("level,id,parent_id,name,expand,sort_index,create_datetime")->setOrderBy('sort_index DESC')->exec();$contentStr='';if($categories['status']=='error'){$contentStr=<<<S
<tr class="noData">
	<td colspan="7" class="error">{$categories['error_msg']}</td>
</tr>
S;
}elseif(!$categories['info']){$contentStr=<<<S
<tr class="noData">
	<td colspan="7">没有数据</td>
</tr>
S;
}else{$categories=$categories['info'];$topCategories=$subCategories=array();array_walk($categories,function($category)use(&$topCategories,&$subCategories){if($category['level']=='0'){$topCategories[]=$category;}else{$subCategories[]=$category;}});foreach($topCategories as$category){$subCateStr='';array_walk($subCategories,function($item)use(&$subCateStr,$category){if($item['parent_id']==$category['id']){$sCategoryInfo=json_encode($item,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);$subCateStr.=<<<S
<tr class="cat-sub" data-category='{$sCategoryInfo}'>
	<td class="td-00"><span class="checkbox-box"><span class="pseudo-checkbox"></span><input type="checkbox" class="J_CatOpt checkbox"></span></td>
	<td class="td-0"></td>
	<td class="td-1"><div class="input-box"><input type="text" class="input-text J_CatName " value="{$item['name']}" maxlength="20"></div></td>
	<td class="td-move">
		<div class="move-box">
			<a class="move-top J_CatMoveTop no-move-top" href="#" title="移动到顶部">上移</a>
			<a class="move-up J_CatMoveUp no-move-up" href="#" title="上移">上移</a>
			<a class="move-down J_CatMoveDown no-move-down" href="#" title="下移">下移</a>
			<a class="move-btm J_CatMoveBtm no-move-btm" href="#" title="移动到底部">下移</a>
		</div>
	</td>
	<td class="td-3"></td>
	<td class="td-time">{$item['create_datetime']}</td>
	<td class="td-9"><a class="J_CatDelete" href="#" title="删除">删除</a></td>
</tr>
S;
}});if($category['expand']){$expandCls=$expandProp=" checked";}else{$expandCls=$expandProp="";}$tCategoryInfo=json_encode($category,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);$contentStr.=<<<S
<tbody class="folding">
	<tr class="cat-sup" data-category='{$tCategoryInfo}'>
		<td class="td-00">
        	<span class="checkbox-box">
            	<span class="pseudo-checkbox"></span>
            	<input type="checkbox" class="checkbox">
            </span>
        </td>
        <td class="td-0"><i class="J_FoldTrigger arrow arrow-left"></i></td>
        <td class="td-1">
            <div class="input-box"><input type="text" class="input-text J_CatName" autocomplete="off" value="{$category['name']}" maxlength="20"></div>
        </td>
        <td class="td-move">
            <div class="move-box">
                <a href="#" class="move-top J_CatMoveTop">上移</a>
                <a class="move-up  J_CatMoveUp" href="#">上移</a>
                <a class="move-down J_CatMoveDown" href="#">下移</a>
                <a href="#" class="move-btm J_CatMoveBtm">下移</a>
            </div>
        </td>
        <td class="td-3">
			<span class="switch-box{$expandCls}">
				<span class="pseudo-switch"></span>
				<input type="checkbox" class="J_CatShow checkbox"{$expandProp}>
			</span>
        </td>
		<td class="td-time">{$category['create_datetime']}</td>
		<td class="td-9">
        	<a class="J_CatDelete" href="#">删除</a>
		    <!--<a href="#" target="_blank">查看</a>-->
        </td>
	</tr>{$subCateStr}
	<tr class="cat-sub add-sub" data-parent-id="{$category['id']}">
		<td class="td-00"></td>
		<td class="td-0"></td>
		<td class="td-1"><a href="#" class="add-cat J_AddCat"><span><em>添加子分类</em></span></a></td>
		<td class="td-move"></td>
		<td class="td-3"></td>
		<td class="td-time"></td>
		<td class="td-7"></td>
	</tr>
</tbody>
S;
}}?> <div id="zmsun_toolbar"><div class="manage-title"><a class="button addTopCategoryBtn">添加分类</a></div><div class="toolbar-opts"><a href="#" class="saveCategroyChangeBtn"><span>保存更改</span></a></div></div><div class="manage-cats"><div class="select-opt selectall"><b class="cat-checkbox"></b><i>全选</i></div><div class="title-nav toolbar-opts"><a class="batchDelBtn disabled" href="#"><span>批量删除</span></a></div><div class="table-title"><table class="cats-table"><colgroup><col width="3%"><col width="2.5%"><col width="19%"><col width="14.6%"><col width="10%"><col width="12.5%"><col width="auto"></colgroup><tbody><tr class="table-title"><td class="td-00">&nbsp;</td><td class="td-0">&nbsp;</td><td class="td-1">分类名称</td><td class="td-4">移动</td><td class="td-3">默认展开</td><td class="td-timeh">创建时间</td><td class="td-9">操作</td></tr></tbody></table></div><div class="table-outer"><form name="cateForm"><table class="cats-table"><colgroup><col width="3%"><col width="2.5%"><col width="19%"><col width="14.6%"><col width="10%"><col width="12.5%"><col width="auto"></colgroup><?php echo$contentStr ?> </table></form></div></div>